/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kenny.wiki.ejb.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "title_item", catalog = "wiki", schema = "")
@NamedQueries({
    @NamedQuery(name = "TitleItem.findAll", query = "SELECT t FROM TitleItem t"),
    @NamedQuery(name = "TitleItem.findByTiId", query = "SELECT t FROM TitleItem t WHERE t.tiId = :tiId"),
    @NamedQuery(name = "TitleItem.findByTitleId", query = "SELECT t FROM TitleItem t WHERE t.titleId = :titleId"),
    @NamedQuery(name = "TitleItem.findByUserId", query = "SELECT t FROM TitleItem t WHERE t.userId = :userId"),
    @NamedQuery(name = "TitleItem.findByTiName", query = "SELECT t FROM TitleItem t WHERE t.tiName = :tiName"),
    @NamedQuery(name = "TitleItem.findByTiContent", query = "SELECT t FROM TitleItem t WHERE t.tiContent = :tiContent"),
    @NamedQuery(name = "TitleItem.findByTiTime", query = "SELECT t FROM TitleItem t WHERE t.tiTime = :tiTime"),
    @NamedQuery(name = "TitleItem.findByTiVersion", query = "SELECT t FROM TitleItem t WHERE t.tiVersion = :tiVersion"),
    @NamedQuery(name = "TitleItem.findByTitleIdAndTiDisplay", query = "SELECT t FROM TitleItem t WHERE t.titleId = :titleId and t.tiDisplay = :tiDisplay"),
    @NamedQuery(name = "TitleItem.findByTiDisplay", query = "SELECT t FROM TitleItem t WHERE t.tiDisplay = :tiDisplay")})
public class TitleItem implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ti_id", nullable = false)
    private Integer tiId;
    @Basic(optional = false)
    @Column(name = "title_id", nullable = false)
    private int titleId;
    @Basic(optional = false)
    @Column(name = "user_id", nullable = false)
    private int userId;
    @Basic(optional = false)
    @Column(name = "ti_name", nullable = false, length = 50)
    private String tiName;
    @Basic(optional = false)
    @Column(name = "ti_content", nullable = false, length = 4000)
    private String tiContent;
    @Basic(optional = false)
    @Column(name = "ti_time", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date tiTime;
    @Basic(optional = false)
    @Column(name = "ti_version", nullable = false)
    private int tiVersion;
    @Basic(optional = false)
    @Column(name = "ti_display", nullable = false)
    private int tiDisplay;

    public TitleItem() {
    }

    public TitleItem(Integer tiId) {
        this.tiId = tiId;
    }

    public TitleItem(Integer tiId, int titleId, int userId, String tiName, String tiContent, Date tiTime, int tiVersion, int tiDisplay) {
        this.tiId = tiId;
        this.titleId = titleId;
        this.userId = userId;
        this.tiName = tiName;
        this.tiContent = tiContent;
        this.tiTime = tiTime;
        this.tiVersion = tiVersion;
        this.tiDisplay = tiDisplay;
    }

    public Integer getTiId() {
        return tiId;
    }

    public void setTiId(Integer tiId) {
        this.tiId = tiId;
    }

    public int getTitleId() {
        return titleId;
    }

    public void setTitleId(int titleId) {
        this.titleId = titleId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getTiName() {
        return tiName;
    }

    public void setTiName(String tiName) {
        this.tiName = tiName;
    }

    public String getTiContent() {
        return tiContent;
    }

    public void setTiContent(String tiContent) {
        this.tiContent = tiContent;
    }

    public Date getTiTime() {
        return tiTime;
    }

    public void setTiTime(Date tiTime) {
        this.tiTime = tiTime;
    }

    public int getTiVersion() {
        return tiVersion;
    }

    public void setTiVersion(int tiVersion) {
        this.tiVersion = tiVersion;
    }

    public int getTiDisplay() {
        return tiDisplay;
    }

    public void setTiDisplay(int tiDisplay) {
        this.tiDisplay = tiDisplay;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (tiId != null ? tiId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TitleItem)) {
            return false;
        }
        TitleItem other = (TitleItem) object;
        if ((this.tiId == null && other.tiId != null) || (this.tiId != null && !this.tiId.equals(other.tiId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.kenny.wiki.ejb.entity.TitleItem[tiId=" + tiId + "]";
    }

}
